package com.kawa.kemanage.mapper;

import com.kawa.kemanage.entity.SystemNotice;
import com.kawa.kemanage.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
@Mapper
public interface SystemNoticeMapper {
    /*
    查询
     */
    List<SystemNotice> selectAll();

//    String searchNotice( String userName);
//    String searchNotice(@Param("keyword") String userName);
    List<User> searchNotice(@Param("keyword") String userName);
    /*
    增加
     */
    int addNotice(SystemNotice systemNotice);
    /*
    删除
     */
    Integer deleteNotice(Integer notificationId);
    /*
    修改
     */
    int updateNotice(SystemNotice systemNotice);
    int updateNewsStatusAndReadTime(@Param("notificationId") Integer notificationId,
                                    @Param("readTime") Date readTime,
                                    @Param("status") String status);


    /**
     * 根据用户id查询评论消息
     * @param user_id
     * @return
     */
    List<SystemNotice> selectNoticeByUserId(@Param("userId") Integer user_id);

    /**
     * 根据用户id查询对应的系统通知
     * @param userId
     * @return
     */
    List<SystemNotice> selectByUserId(Integer userId);
}

